home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _GETROWS.C < prev    next >
Text File  |  1992-11-21  |  3KB  |  111 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3.  
  4. #ifndef        NDEBUG
  5. char *rcsid__getrows = "$Header: c:/curses/private/RCS/_getrows.c%v 2.0 1992/11/15 03:24:26 MH Rel $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_get_rows()       - Return number of screen rows.
  14.  
  15.   PDCurses Description:
  16.        This is a private PDCurses routine.
  17.  
  18.        Returns the maximum number of rows supported by the display.
  19.        e.g.  25, 28, 43, 50, 60, 66...
  20.  
  21.   PDCurses Return Value:
  22.        This function returns OK on success and ERR on error.
  23.  
  24.   PDCurses Errors:
  25.        No errors are defined for this function.
  26.  
  27.   Portability:
  28.        PDCurses        int PDC_get_rows( void );
  29.  
  30. **man-end**********************************************************************/
  31.  
  32. int    PDC_get_rows(void)
  33. {
  34. #ifdef FLEXOS
  35.                return (vir.vc_size.rs_nrows);
  36. #endif
  37. #ifdef DOS
  38.        char far*       ROWS;
  39.        int             rows;
  40.        char *env_rows;
  41. /* use the value from LINES environment variable, if set. MH 10-Jun-92 */
  42. /* and use the minimum of LINES and *ROWS.                MH 18-Jun-92 */
  43.        ROWS = (char far *) 0x0484L;
  44.        rows = *ROWS + 1;
  45.        env_rows = (char *)getenv("LINES");
  46.        if (env_rows != (char *)NULL)
  47.                rows = min(atoi(env_rows),rows);
  48.  
  49.        if ((rows == 1) && (_cursvar.adapter == _MDS_GENIUS))
  50.                rows = 66;
  51.        if ((rows == 1) && (_cursvar.adapter == _MDA))
  52.                rows = 25;  /* new test MH 10-Jun-92 */
  53.        if (rows == 1)
  54.        {
  55.                rows = _default_lines;  /* Allow pre-setting LINES       */
  56.                _cursvar.direct_video = FALSE;
  57.        }
  58.        switch (_cursvar.adapter)
  59.        {
  60.        case _EGACOLOR:
  61.        case _EGAMONO:
  62.                switch (rows)
  63.                {
  64.                case 25:
  65.                case 43:
  66.                        break;
  67.                default:
  68.                        rows = 25;
  69.                }
  70.                break;
  71.  
  72.        case _VGACOLOR:
  73.        case _VGAMONO:
  74. /* lets be reasonably flexible with VGAs - they could be Super VGAs */
  75. /* capable of displaying any number of lines. MH 10-Jun-92          */
  76. /*
  77.                switch (rows)
  78.                {
  79.                case 25:
  80.                case 28:
  81.                case 50:
  82.                        break;
  83.                default:
  84.                        rows = 25;
  85.                }
  86. */
  87.                break;
  88.  
  89.        default:
  90.                rows = 25;
  91.                break;
  92.        }
  93.        return (rows);
  94. #endif
  95. #ifdef OS2
  96.        VIOMODEINFO modeInfo;
  97.        int             rows;
  98.        char *env_rows;
  99. /* use the value from LINES environment variable, if set. MH 10-Jun-92 */
  100. /* and use the minimum of LINES and *ROWS.                MH 18-Jun-92 */
  101.  
  102.        modeInfo.cb = sizeof(modeInfo);
  103.        VioGetMode(&modeInfo, 0);
  104.        rows = modeInfo.row;
  105.        env_rows = (char *)getenv("LINES");
  106.        if (env_rows != (char *)NULL)
  107.                rows = min(atoi(env_rows),rows);
  108.        return(rows);
  109. #endif
  110. }
  111.